package mapper;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * HadoopMapper
 *
 * @author zhangyimin
 * @version 1.0
 * @date 2018-07-20 上午10:02
 */
public class HadoopMapper extends Mapper<LongWritable, Text, Text, LongWritable> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String str = value.toString();

        String strs[] =str.split(" ");
        for (String s:strs){
            context.write(new Text(s),new LongWritable(1));
        }
    }
}
